package cn.virens.util.poi.read;

import cn.virens.util.poi.exception.ExcelException;

public class CellObject<D> {
	private final CellReader<D> readCell;
	private final RowObject rowObject;

	private D object;
	private ExcelException exception;

	protected CellObject(CellReader<D> readCell, RowObject rowObject) {
		this.readCell = readCell;
		this.rowObject = rowObject;
	}

	public CellReader<D> getReadCell() {
		return readCell;
	}

	public RowObject getRowObject() {
		return rowObject;
	}

	public boolean isRead() {
		return exception == null;
	}

	public String getName() {
		return readCell.getName();
	}

	public int getCellIndex() {
		return readCell.getIndex();
	}

	public int getRowIndex() {
		return rowObject.getRowIndex();
	}

	public D getObject() {
		return object;
	}

	protected void setObject(D object) {
		this.object = object;
	}

	public ExcelException getException() {
		return exception;
	}

	public void setException(ExcelException exception) {
		this.exception = exception;
	}
}
